package com.gdut;

import java.util.StringJoiner;

public class demo10 {
    public static void main(String[] args) {
        //StringBuilder
        StringBuilder sb = new StringBuilder();
        sb.append(1).append(2.2).append("abc").append(true);
        sb.reverse();
        System.out.println(sb);
        int len = sb.length();
        System.out.println(len);
        String str = sb.toString();
        System.out.println(str);
        //StringJoiner
        StringJoiner sj = new StringJoiner("--", "[", "]");
        for (int i = 0; i < 10; i++) {
            char c = (char) (i + '0');
            String s = c + "";
            sj.add(s);
        }
        String str1 = sj.toString();
        System.out.println(str1);
    }
}
